<html>
<head>
	<meta charset="utf-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<meta http-equiv="Content-type" content="text/html; charset=utf-8">
	<meta name="description" content="">
	<meta name="author" content="">
	<title>ACE Editor Demo</title>

	<script src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
	<script src="http://cdn.bootcss.com/ace/1.2.4/ace.js"></script>
	<script src="http://cdn.bootcss.com/ace/1.2.4/ext-language_tools.js"></script>
	<script src="http://cdn.bootcss.com/ace/1.2.4/ext-old_ie.js"></script>
	<script src="http://cdn.bootcss.com/ace/1.2.4/theme-monokai.js"></script>
</head>
<body>
	<form id="listFm" name="listFm" method="post" action="${context}/ace/list.do">
		<table>
            <thead>
                <tr role="row" class="heading">
                    <th>序号</th>
                    <th>标题</th>
                    <th>操作</th>
                </tr>
            </thead>
            <tbody>
            	<#if list?? && list?size gt 0>
            		<#list list as item>
					<tr>
						<td>${item_index + 1}</td>
						<td><#if item.title??>${item.title?html}</#if></td>
						<td>
							<button type="button" onclick="javascript:editAce('${item.id?if_exists}');">修改</button>
							<button type="button" onclick="javascript:delAce('${item.id?if_exists}');">删除</button>
							<button type="button" onclick="javascript:viewAce('${item.id?if_exists}');">查看</button>
						</td>
					</tr>
					</#list>
				</#if>
			</tbody>
		</table>
	</form>
	
	<form id="editFm" action="${context}/ace/add.do">
		<input type="hidden" id="editId" name="id"/>
	</form>
	<form id="delFm" action="${context}/ace/del.do">
		<input type="hidden" id="delId" name="id"/>
	</form>
	<form id="viewFm" action="${context}/ace/view.do">
		<input type="hidden" id="viewId" name="id"/>
	</form>
    
	<script type="text/javascript">
	
		function editAce(id){
			$("#editId").val(id);
			$("#editFm").submit();
		}	
		
		function delAce(id){
			$("#delId").val(id);
			$("#delFm").submit();
		}
		
		function viewAce(id){
			$("#viewId").val(id);
			$("#viewFm").submit();
		}					
	</script>
</body>
</html>